/*
 * Copyright (c) 2018, apexes.net. All rights reserved.
 *
 *         http://www.apexes.net
 *
 */
package net.apexes.maven;

import okhttp3.OkHttpClient;

import java.net.URI;
import java.nio.file.Path;
import java.util.List;

/**
 * @author hedyn
 */
public class Mavens {

    /**
     * Set download path
     *
     * @param path Path (non-null)
     * @return MavenDownloaderBuilder instance
     */
    public static MavenDownloaderBuilder withDownloadPath(Path path) {
        return new MavenDownloaderBuilder().withDownloadPath(path);
    }

    /**
     * Set {@link OkHttpClient} instance what'll be used in this {@link MavenDownloader} instance
     *
     * @param client {@link OkHttpClient} instance
     * @return MavenDownloaderBuilder instance
     */
    public MavenDownloaderBuilder withOkHttpClient(OkHttpClient client) {
        return new MavenDownloaderBuilder().withOkHttpClient(client);
    }

    /**
     * Set depencencies list, what to download
     *
     * @param dependencies List of {@link Dependency}
     * @return MavenDownloaderBuilder instance
     */
    public MavenDownloaderBuilder withDependencies(List<Dependency> dependencies) {
        return new MavenDownloaderBuilder().withDependencies(dependencies);
    }

    /**
     * Set repositories list, where to look up dependencies
     *
     * @param repositories List of repository {@link URI}s
     * @return MavenDownloaderBuilder instance
     */
    public MavenDownloaderBuilder withRepositories(List<URI> repositories) {
        return new MavenDownloaderBuilder().withRepositories(repositories);
    }

    /**
     * Set {@link DownloadCallback} to get information about downloads
     *
     * @param downloadCallback Implementation of {@link DownloadCallback}
     * @return MavenDownloaderBuilder instance
     */
    public MavenDownloaderBuilder withDownloadCallback(DownloadCallback downloadCallback) {
        return new MavenDownloaderBuilder().withDownloadCallback(downloadCallback);
    }
}
